<!DOCTYPE html>
<html ng-app='resetPassApp'>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="/apps/app/bower_components/angular/angular.min.js"></script>
    </head>
    <body>
        <div class="" ng-controller="ResetPassCtrl">

            <label for="passwd">密码：</label>
            <input type="password" class="form-control" ng-model="passwd" name="passwd" placeholder="请输入密码..." required>

            <!-- <p>
                        <span style="color:red" ng-show="registerForm.password.$invalid">
                            <span ng-show="registerForm.password.$error.minlength">*密码长度不小于6</span>
                            <span ng-show="registerForm.password.$error.maxlength">*密码长度不超过20</span>
                        </span>
                    </p> -->

            <!-- <div id="passwordagaingroup">
                    <label for="passwordagain">再输入一遍密码：</label>
                    <input type="password" class="form-control" ng-model="passwordagain" name="passwordagain" id="passwordagain" placeholder="请再输一遍密码..." required>
                    <p>
                        <span style="color:red" ng-show="registerForm.password.$valid">
                            <span ng-show="passwordagain!=password">*两次密码输入不一致</span>
                        </span>
                    </p>
                </div> -->
            <div>
                <button class="btn btn-lg btn-primary btn-block" ng-disabled="passwd==null" ng-click="resetPass(passwd)">重置密码</button>
            </div>

        </div>
        <script type="text/javascript">
            var app = angular.module('resetPassApp', []);
            app.controller('ResetPassCtrl', function($scope, $http) {
              $scope.resetPass = function(passwd){
                $http.post('/apps/services/auth/changepassword/'+passwd)
                .success(function(data, status, headers, config) {
                    alert(data.msg);
                    window.location.replace("/apps/index.html");
                });
              };
            });
        </script>
    </body>
</html>
